package auth

import (
	"github.com/gin-gonic/gin"
)

// RegisterRoutes 注册认证模块路由
func RegisterRoutes(router *gin.RouterGroup, handler *Handler) {
	// 认证相关路由
	authGroup := router.Group("/auth")
	{
		authGroup.POST("/login", handler.Login)
		authGroup.POST("/refresh", handler.RefreshToken)
	}

	// 用户管理路由
	userGroup := router.Group("/users")
	{
		userGroup.GET("", handler.ListUsers)
		userGroup.POST("", handler.CreateUser)
		userGroup.GET("/:id", handler.GetUser)
		userGroup.PUT("/:id", handler.UpdateUser)
		userGroup.DELETE("/:id", handler.DeleteUser)

		// 用户角色管理
		userGroup.GET("/:user_id/roles", handler.GetUserRoles)
		userGroup.POST("/:user_id/roles", handler.AssignRolesToUser)
	}

	// 角色管理路由
	roleGroup := router.Group("/roles")
	{
		roleGroup.GET("", handler.ListRoles)
		roleGroup.POST("", handler.CreateRole)
		roleGroup.GET("/:id", handler.GetRole)
		roleGroup.PUT("/:id", handler.UpdateRole)
		roleGroup.DELETE("/:id", handler.DeleteRole)
	}
}
